package com.sz.common.pay.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Function: PAYMENT LOGGER <br>
 *     只提供 info 与 error 两种日志
 * Author: siqishangshu <br>
 * Date: 2017-10-26 14:24:00
 */
public class PayLogger {
    
    private  Logger logger;

    /**
     * 构造方法，初始化Log4j的日志对象
     */
    private PayLogger(Logger logger) {
        this.logger = logger;
    }

    /**
     * 获取构造器，根据类初始化Logger对象
     * @return Logger对象
     */
    public static PayLogger getLogger(Class clazz) {
        return new PayLogger(LoggerFactory.getLogger(clazz));
    }

    /**
     * 获取构造器，根据类名初始化Logger对象
     * @return Logger对象
     */
    public static PayLogger getLogger(String loggerName) {
        return new PayLogger(LoggerFactory.getLogger(loggerName));
    }

    public void info(String str) {
        logger.info(str);
    }

    public void info(String sequence, String string) {
        logger.info("["+sequence+"]" + string);
    }

    public void error(String str) {
        logger.error(str);
    }

    public void error(String sequence, String string) {
        logger.error("["+sequence+"]" + string);
    }

    public void error(String msg, Throwable t) {
        logger.error(msg, t);
    }


    public String getName() {
        return logger.getName();
    }
}
